package com.zhangshitong.springbootModel.common;

import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.boot.web.servlet.ErrorPageRegistrar;
import org.springframework.boot.web.servlet.ErrorPageRegistry;
import org.springframework.http.HttpStatus;

/**
 * 修改springboot 404 500错误到系统指定的页面
 * @author Administrator
 *
 */
public class CommonErrorPageRegistrar implements ErrorPageRegistrar {

	@Override
	public void registerErrorPages(ErrorPageRegistry registry) {

		ErrorPage e404 = new ErrorPage(HttpStatus.NOT_FOUND, "/html/404.html");
		ErrorPage e500 = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/html/500.html");
		registry.addErrorPages(e404,e500);
	}

}
